<%@ page language="java" import="java.util.*" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Barracks</title>
</head>
<body>
<%
	ArrayList<Integer> tUNIT_ID = (ArrayList<Integer>)request.getAttribute("tUnits");
	ArrayList<Integer> tMove = (ArrayList<Integer>)request.getAttribute("tMove");
	ArrayList<Integer> tCost = (ArrayList<Integer>)request.getAttribute("tCost");
	ArrayList<Integer>	tCap = (ArrayList<Integer>)request.getAttribute("tCap");
	ArrayList<Double> tCombat = (ArrayList<Double>)request.getAttribute("tCombat");
	ArrayList<String> tName = (ArrayList<String>)request.getAttribute("tName");
	ArrayList<Integer> tCount = (ArrayList<Integer>)request.getAttribute("tCount");
	Integer resQuantity = null;
	if(session.getAttribute("Resources")!=null){
		resQuantity = (Integer)session.getAttribute("Resources");
	}
%>
	<div style="width: 100%;text-align:center;">
		Resources: <%=resQuantity%>
	</div>
	<div style="width: 300px;height: 100%; float: left">
		<a href="Overview" style="width: 300px;float: left">Overview</a>
		<a href="Structures" style="width: 300px;float: left">Structures</a>
		<a href="Research" style="width: 300px;float: left">Research</a>
		<a href="Barracks" style="width: 300px;float: left">Barracks</a>
		<a href="Island" style="width: 300px;float: left">Island</a>
		<a href="Movement" style="width: 300px;float: left">Movement Report</a>
		<a href="Messages" style="width: 300px;float: left">Messages</a>
	</div>
	
	<table border="1" cellspacing="0">
		<tr>
			<th>Name</th>
			<th>Cost</th>
			<th>Count</th>
			<th>Build</th>
		</tr>
		<%
		Iterator<Integer> iter = tUNIT_ID.iterator();
		while(iter.hasNext()){
			Integer next = iter.next();
			int index = tUNIT_ID.indexOf(next);
			
			%>
			<tr>
			<td><%out.print(tName.get(index));%></td>
			<td><%out.print(tCost.get(index));%></td>
			<td><%out.print(tCount.get(index));%></td>
			<td>
			<form action="Barracks" method="post">
				<input type="hidden" value="<%=next%>" name="ID" />
				<input type="text" value="1" name="count"/>
				<input type="submit" value="Build">
			</form></td>
			</tr>
			
			<%
		}
		%>
	</div>
	
</body>
</html>